function requset(url, options) {
    return new Promise((resolve, reject) => {
        fetch(url)
            .then((response)=>{
                return resolve(response.json())
            })
            .catch((e)=>{
                throw new Error("响应不正确"+e)
            })

    })
}
let parseJSON = (data) => {
    return data.json()
}

let checkStatus = (response) => {
    if (response.status >= 200 && response.status < 300) {
        return response
    } else {
        throw new Error("响应结果不正确")
    }

}
let checkcode = (response) => {
    console.log(response.json())
    // if (data.code == 0) {
    //     return data;
    // }else{
    //     throw new Error("响应结果不正确")
    // }
}
export default { requset, name }